package com.shen.thread.demo1.lambdaa;

public class Test {

    public static void main(String[] args) {
        ILike like = new Like();
        like.lambda();

        ILike like2 = new Like2();
        like2.lambda();

        class Like3 implements ILike {//局部内部类

            @Override
            public void lambda() {
                System.out.println("i like3");
            }
        }
        like = new Like3();
        like.lambda();
        //匿名内部类
        like = new ILike() {
            @Override
            public void lambda() {
                System.out.println("I like4");
            }
        };
        like.lambda();

        //lambda
        like = () -> {
            System.out.println("I like5");
        };
        like.lambda();

    }

    static class Like2 implements ILike {//静态内部类

        @Override
        public void lambda() {
            System.out.println("i like2");
        }
    }

}



